


<#include "${ftl_skin}/common/header.ftl">

</head>

<body class="fixed-sidebar full-height-layout gray-bg" style="overflow:hidden">


<!--Tabs右键菜单的源-->
<div class="contextMenu" id="menuTabs-contextmenu" style="display: none;">
    <ul>
        <li id="reload"><i class="fa fa-refresh"></i> 刷新</li>
    </ul>
</div>

<div id="wrapper">
    <#--<h2 class="side-tit">${sys_name}</h2>-->
    <!--左侧导航开始-->
    <nav class="navbar-default navbar-static-side" role="navigation">
        <div class="sidebar-collapse">
            <ul class="nav" id="side-menu">
                <li><a id="newIframe" class="J_menuItem" href="javascript:void(0);" data-index="0" style="display:none;"></a></li>
            </ul>
        </div>
    </nav>
    <!--左侧导航结束-->
    <!--右侧部分开始-->
    <div id="page-wrapper" class="gray-bg dashbard-1">
        <div class="row border-bottom">
            <nav class="navbar navbar-static-top" role="navigation" style="margin-bottom: 0">
                <div class="navbar-header"><!--<a class="navbar-minimalize minimalize-styl-2 btn btn-primary " href="#"><i class="fa fa-bars"></i> </a>-->


                </div>
                <ul class="nav navbar-top-links navbar-right">

                    <li class="dropdown">
                        <a class="dropdown-toggle count-info" data-toggle="dropdown" href="#">
                            <i class="fa fa-user"></i> ${user.user_name}
                        </a>
                        <ul class="dropdown-menu animated fadeInRight m-t-xs">
                            <li><a href="#" onClick="modifypassword();return false;">修改密码</a>
                            </li>
                            <li class="divider"></li>
                            <li><a href="#" onClick="javascript:HFLogout();return false;">安全退出</a>
                            </li>
                        </ul>
                    </li>
                    <!--
                        <li><a href="#"><@spring.message "lang.name" /></a></li>
                        -->
                </ul>
            </nav>
        </div>
        <div class="row content-tabs">
            <button class="roll-nav roll-left J_tabLeft"><i class="fa fa-backward"></i>
            </button>
            <nav class="page-tabs J_menuTabs">
                <div class="page-tabs-content">
                    <a href="javascript:;" class="active J_menuTab" data-id="index_v1.html">首页</a>
                </div>
            </nav>
            <button class="roll-nav roll-right J_tabRight"><i class="fa fa-forward"></i>
            </button>
            <div class="btn-group roll-nav roll-right">
                <button class="dropdown J_tabClose" data-toggle="dropdown">关闭操作<span class="caret"></span>

                </button>
                <ul role="menu" class="dropdown-menu dropdown-menu-right">
                    <li class="J_tabShowActive"><a>定位当前选项卡</a>
                    </li>
                    <li class="divider"></li>
                    <li class="J_tabCloseAll"><a>关闭全部选项卡</a>
                    </li>
                    <li class="J_tabCloseOther"><a>关闭其他选项卡</a>
                    </li>
                </ul>
            </div>
            <a href="#" onClick="javascript:HFLogout();return false;" class="roll-nav roll-right J_tabExit"><i class="fa fa fa-sign-out"></i> 退出</a>
        </div>
        <div class="row J_mainContent" id="content-main">
            <iframe class="J_iframe" name="iframe0" width="100%" height="100%" src="${home_page!}" frameborder="0" data-id="index_v1.html" seamless></iframe>
        </div>
        <div class="footer">
            <div class="pull-right">&copy; 2017-2018
            </div>
        </div>
    </div>
    <!--右侧部分结束-->
    <div id="small-chat">

        <div id="hf-icon" >&nbsp;</div>
        <!--
        <img src="${path.skinPath!}hongfeng/hf-icon32.png" style="width: 32px; height: 32px; overflow: hidden;" />
        -->
        <!--
        <span class="badge badge-warning pull-right">5</span>

        <a class="open-small-chat">
            <i class="fa fa-comments"></i>
        </a>
        -->
    </div>
</div>




<#include "${ftl_skin}/common/js.ftl">




<script type="text/javascript" src="${path.commonPath }tools/yxTree/yx.yxTree.js"></script>


<script type="text/javascript">

    var tree = new yxTree('tree');


    $(function(){
        loadMenu();
        //定时访问后台不做操作，保持登录状态
        timerAccess();
        //getIndexUnreadCount();
    });
    //查询index页面消息未读数
    function getIndexUnreadCount(count) {
        var unreadCount = 0;
        //$("div[id^='unreadMessageType']").empty().append(0);
        if(count != null) {
            unreadCount = count;
        } else {
            HFAjax("${path.servicePath }message/getunreadcountmap.do", '', function(data){
                if(data.result == null)
                    return;
                $.each(data.result, function (i, r) {
                    $("#unreadIndexMessageType" + r.MESSAGE_TYPE).empty().append(r.TYPE_COUNT);
                    unreadCount += r.TYPE_COUNT;
                });
            });
        }
        if(unreadCount == 0)
            $("#unreadCountSpan").hide();
        else
            $("#unreadCountSpan").show();
        $("#unreadCount").empty().append(unreadCount);
    }

    //加载菜单
    function loadMenu(){
        HFAjax("${path.servicePath}/menu/treelistauth.do", {parent_tree_code:'${parentSeqCode!}'}, function(data){
            if(data.state == 0){
                var msg = data.result;

                for(var i in msg){
//                         alert(msg[i].PARENT_TREE_CODE + '_' + msg[i].TREE_CODE);
                    tree.nodes[msg[i].parent_tree_code + '_' + msg[i].tree_code] = 'text:' + msg[i].node_name + ';url:' + msg[i].url + ';icon:' + msg[i].icon;
                }

                //输出 json 格式
                var treeNodes = tree.toArr();

                var menuHtml = treeToMenuHTMl(treeNodes[0].childNodes, 1);


                $('#side-menu').append(menuHtml);

                //初始化左边菜单
                $("#side-menu").metisMenu();
                initJMenuItem();
            }
        });
    }

    //把数组转换成 json
    function treeToMenuHTMl(treeNodeArr, nodeDeep){
        var str = '';
        for(var i = 0; i < treeNodeArr.length; i++){

            if(nodeDeep == 1){

                str += '<li ' + (i==0?'class="active"':'') + '><a href="#"><i class="'+ treeNodeArr[i].icon +'"></i><span class="nav-label">' + treeNodeArr[i].text + '</span><span class="fa arrow"></span></a>';
            }else{
                str += '<li><a class="J_menuItem" href="' + treeNodeArr[i].url + '" data-index="0">' + treeNodeArr[i].text;
                if(treeNodeArr[i].hasChild){
                    str += '<span class="fa arrow"></span>';
                }
                str += '</a>';
            }

            if(treeNodeArr[i].hasChild){

                if(nodeDeep == 1){
                    str += '<ul class="nav nav-second-level">';
                }
                if(nodeDeep == 2){
                    str += '<ul class="nav nav-third-level">';
                }

                str += treeToMenuHTMl(treeNodeArr[i].childNodes, nodeDeep + 1);

                str += '</ul>';
            }
            str += '</li>';
        }

        return str;
    }


    //变更语言
    function changeLang(new_lang){
        HFAjax("${path.servicePath }index/setlang.do", {
            new_lang : new_lang
        }, function(result){
            if(result.state == 0){
                //HFAlert('完成了');
                //winGo("${path.viewPath }admin/index.do");
                winReload();
            }
        });
    }

    function modifypassword(){
        $('#dropdown').removeClass('open');
        openDialog('item_edit', '修改密码', '${path.viewPath}admin/modifypassword.do', '', 550, 300, function(){
            return false;
        });
        return false;
    }

    // 打开新标签
    function toNewIframe(){
        $("#newIframe").click();
    }

    // 改成当前标签的title
    function updataActiveTitle(title){
        $(".J_menuTabs a.J_menuTab").filter(".active").html(title+" <i class=\"fa fa-times-circle\"></i>");
    }



    //定时访问后台不做操作，保持登录状态
    function timerAccess(){
        //循环执行，每隔5秒钟执行一次
        var t1=window.setInterval(refreshCount, 6000);
    }
    function refreshCount() {
        var timestamp;
        timestamp=new Date().getTime();
        console.log("ready");
        HFAjax("${path.servicePath }admin/sessionlong.do?timestamp="+timestamp, {
        }, function(result){

        });
    }


</script>

<#include "${ftl_skin}/common/footer.ftl">

